package com.qf.controller;

import com.qf.pojo.Admin;
import com.qf.pojo.User;
import com.qf.service.AdminService;
import com.qf.utils.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author zdl
 * @date 2025/2/10
 */
@RestController
@RequestMapping("/admin")
public class AdminController {
    @Resource
    private AdminService adminService;

    @PostMapping("/login")
    public R<Admin> loginAdminByUsernameAndPassword(@RequestBody User user) {
        Admin admin = adminService.loginAdminByUsernameAndPassword(user.getUsername(), user.getPassword());
        return R.ok(admin);
    }

}
